// localStorage.setItem("url",'http://localhost:30000/');
localStorage.setItem("url",'https://www.normalsys.cn/api/');
layui.use('form', function(){
    var form = layui.form;
    //监听提交
    form.on('submit(login)', function(data){

        $.ajax({
            url:localStorage.getItem("url")+'ms-pms/login/sign',
            method:'POST',
            contentType:'application/json',
            dataType:'json',
            data:JSON.stringify(data.field),
            success:function (res) {
                if(res.code == 100000) {
                    localStorage.setItem("token",res.data.token);
                    localStorage.setItem("menus", JSON.stringify(res.data.menus));
                    location.href='index.html'
                } else {
                    layer.msg(res.msg);
                }
            }
        })
        return false;//停止 false 阻止表单跳转
    })

});